package com.rosiminc.pm.game.tiles;

import com.rosiminc.pm.game.Tile;

/**
 * This abstract object represents a game board pipe tile and provides methods
 * to handle the contents and actions of that said tile.
 * 
 * @author Shymon
 * 
 */
public abstract class GameBoardTile {

	private int row;
	private int col;
	private boolean lastSolved;

	/**
	 * This constructor creates the tile at a given position.
	 * 
	 * @param row
	 *            the tile's row
	 * @param col
	 *            the tile's column
	 * @throws IllegalArgumentException
	 *             if row or column are below zero
	 */
	protected GameBoardTile(int row, int col) {
		if (row < 0)
			throw new IllegalArgumentException(
					"Row must be at least equal to zero");
		if (col < 0)
			throw new IllegalArgumentException(
					"Column must be at least equal to zero");
		this.row = row;
		this.col = col;
		this.lastSolved = false;
	}

	/**
	 * This method returns the tile's row
	 * 
	 * @return the tile's row
	 */
	public int getRow() {
		return row;
	}

	/**
	 * This method returns the tile's column.
	 * 
	 * @return the tile's column
	 */
	public int getColumn() {
		return col;
	}

	/**
	 * This method returns the basic pipe tile of the game board tile.
	 * 
	 * @return the tile
	 */
	public abstract Tile getTile();

	/**
	 * This method specifies if the tile was solved when last checked.
	 * 
	 * @param solved
	 *            if tile was solved
	 */
	public void setLastSolved(boolean solved) {
		this.lastSolved = solved;
	}

	/**
	 * This method returns if the tile was solved when last checked.
	 * 
	 * @return if tile was solved
	 */
	public boolean getLastSolved() {
		return this.lastSolved;
	}

	/**
	 * This method performs the tile's primary action.
	 */
	public abstract void actionA();

	/**
	 * This method performs the tile's secondary action.
	 */
	public abstract void actionB();

	/**
	 * This method randomly assigns a possible changed value to the tile.
	 */
	public abstract void shuffle();

	/**
	 * This method returns the tile's type.
	 * 
	 * @return the tile's type
	 */
	public abstract TileType getTileType();

}
